package cn.tyf.dao;

import cn.tyf.domain.WeChat;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface WeChatDao {

    /**
     * 添加openid数据库，
     * @param uid
     * @param opemid
     */
    @Insert("insert into wx(uid,openid) value(#{arg0},#{arg1})")
    void add(Integer uid,String opemid);

    /**
     * 根据id进行删除
     * @param uid
     */
    @Delete("delete from wx where uid = #{uid}")
    void delete(Integer uid);

    /**
     * 根据id查询
     * @param openId
     * @return
     */
    @Select("select * from wx where openid = #{arg0}")
    WeChat findByOpenid(String openId);

    /**
     * 根据id查询
     * @param uid
     * @return
     */
    @Select("select * from wx where uid = #{arg0}")
    WeChat findByUid(Integer uid);

}
